<include file="Public/min-header"/>
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
</style>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>批量生成激活码</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">通用信息</a></li>
                    </ul>
                    <form method="post" action="{:U('Admin/News/add_batch')}" enctype="multipart/form-data">
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td width="150" class = "text-right">激活码长度:</td>
                                            <td>
                                                <input type="text" name="title" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" class="form-control" style="width:550px;" />
                                                <span id="err_activation_name" style="color:#F00; display:none;"></span>
                                            </td>
                                        </tr>
										<tr>
                                            <td class = "text-right">激活码使用次数:</td>
                                            <td>
                                                <input type="text" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" name="number" style="width:550px;" class="form-control" />
                                            </td>
                                        </tr>
										<tr>
											<td width="150" class = "text-right">激活码类型：</td>
											<td>
											   <select class="form-control" style="width:550px;" name="cat_id">
													<option value="1">卖家</option>
													<option value="2">买家</option>
											   </select>
											</td>
										</tr>
										<tr>
                                            <td width="150" class = "text-right">生成类型:</td>
                                            <td>
                                        		<label><input type="radio" name="status" checked value="number"> 纯数字 </label>
												<label><input type="radio" name="status" value="letter"> 纯英文 </label>
												<label><input type="radio" name="status" value="all"> 数字+英文</label>								
                                            </td>
                                        </tr>
										<tr>
                                            <td class = "text-right">激活码个数:</td>
                                            <td>
                                                <input type="text" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')" name="generate" style="width:550px;" class="form-control" />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="pull-right">
                            <input type="hidden" name="act" value="{$act}">
                            <input type="hidden" name="id" value="{$activationInfo.id}">
                            <input type="submit" class="btn btn-primary" value="保存">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
<script>
$(function(){
	layui.use('upload', function(){
	  var upload = layui.upload;
	  //执行实例
	  //多图片上传
	  var activation_id = '{$activationInfo.activation_id}';
	  upload.render({
		elem: '#fileAllUpload'
		,url: '/Admin/{$cont_name}/imageOne/'
		,multiple: true
		,done: function(res){
			var html = '';
			html+= '<div style="width:100px; text-align:center; margin: 5px; display:inline-block;" class="activation_xc">';
			html+= '	<input type="hidden" value="'+res.data.urlpath+'" name="activation_img[]">';
			html+= '	<a onclick="" href="'+res.data.urlpath+'" target="_blank"><img width="100" height="100" src="'+res.data.urlpath+'"></a>';
			html+= '	<br>';
			html+= '	<a href="javascript:;" onclick="ClearPicArr2(this,\''+res.data.urlpath+'\')">删除</a>';
			html+= '</div>';
			$('#allimg').append(html);
			if(activation_id){
				$.post('/Admin/Goods/addImg',{activation_id:activation_id,img:res.data.urlpath},function(){},'json');	
			}				
		}
	  });
	});
})
function ClearPicArr2(obj, path) {
	$.ajax({
		type: 'GET',
		url: "{:U('Admin/activation/delImg')}",
		data: {
			images: path
		},
		success: function () {
			$(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片               
		}
	});
}
</script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/js/WdatePicker.js"></script>
</html>
